package com.zmj.sy.mom.srv.aps.feign;

import com.zmj.sy.mom.srv.aps.bean.dto.feign.erp.ErpBaseResDto;
import com.zmj.sy.mom.srv.aps.bean.dto.feign.erp.ErpExternalWwxxResDto;
import com.zmj.sy.mom.srv.aps.bean.entity.order.*;
import com.zmj.sy.mom.srv.aps.bean.entity.reportErp.ErpPhaseReport;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

//@FeignClient(url = "http://192.168.200.29:8085/jeecg-boot", name = "erpApiClient") //测试
@FeignClient(url = "${project.feign.erp-url}", name = "erpApiClient") // 马凯本机
public interface ErpApiClient {

    /**
     * 获取施工号信息
     *
     * @param token
     * @return
     */
    @GetMapping("/jgjmesInterface/getSghInformation")
    ErpBaseResDto<ArrayList<ImportErpOrder>> externalSelect(@RequestHeader("token") String token);

    /**
     * 获取物料信息
     *
     * @param token
     * @param orderCode
     * @return
     */
    @GetMapping("/jgjmesInterface/getWlInformation")
    ErpBaseResDto<ArrayList<ImportErpMater>> materList(@RequestHeader("token") String token, @RequestParam("orderId") String orderCode);

    /**
     * 获取工单信息
     *
     * @param token
     * @param orderCode
     * @return
     */
    @GetMapping("/jgjmesInterface/getGdb")
    ErpBaseResDto<ArrayList<ImportErpWorkOrder>> externalGdb(@RequestHeader("token") String token, @RequestParam("orderId") String orderCode);

    /**
     * 查询工单委外信息
     *
     * @param token
     * @param workOrderCode
     * @return
     */
    @GetMapping("/jgjmesInterface/getWwxx")
    ErpBaseResDto<ArrayList<ErpExternalWwxxResDto>> wwxx(@RequestHeader("token") String token,@RequestParam("orderCode")String orderCode, @RequestParam("workOrderCode") String workOrderCode);


    /**
     * 获取工单BOM信息url
     *
     * @param token
     * @param orderCode
     * @return
     */
    @GetMapping("/jgjmesInterface/getBom")
    ErpBaseResDto<ArrayList<ImportErpBom>> orderBom(@RequestHeader("token") String token, @RequestParam("orderId") String orderCode);

    /**
     * 查询工单明细
     *
     * @param token
     * @param orderCode
     * @return
     */
    @GetMapping("/jgjmesInterface/getGdmx")
    ErpBaseResDto<ArrayList<ImportErpWorkOrderDetail>> workOrderDetail(@RequestHeader("token") String token, @RequestParam("orderId") String orderCode);

    /**
     * @Description: 回传erp
     *
     * @author: hejiahui
     * @since: 2024/10/10 14:19
     */
    @PostMapping("/jgjmesInterface/MesRepoFeedback")
    Map<String, Object> mesRepoFeedback(@RequestHeader("token") String token, @RequestBody List<ErpPhaseReport> ErpPhaseReport);
}
